package com.exam.commonbiz.util;

import org.json.JSONException;
import org.json.JSONObject;

import java.util.Iterator;
import java.util.Map;
import java.util.Set;

public class MapUtil {

    public static String getMapString(Map<String, Object> map) {
        Set keys = map.keySet();

        JSONObject jsonObject = new JSONObject();
        for (Iterator i = keys.iterator(); i.hasNext(); ) {
            String key = (String) i.next();
            String value = (String) map.get(key);
            try {
                jsonObject.put(key, value);
            } catch (JSONException e) {
                e.printStackTrace();
            }
        }
        return jsonObject.toString();
    }
}
